package com.example.calcitedemo;

import org.apache.calcite.sql.SqlNode;
import org.apache.calcite.sql.util.SqlVisitor;

import javax.annotation.Nullable;

/** Argument handler.
 *
 * @param <R> result type */
public interface ArgHandler<R> {
    /** Returns the result of visiting all children of a call to an operator,
     * then the call itself.
     *
     * <p>Typically the result will be the result of the last child visited, or
     * (if R is {@link Boolean}) whether all children were visited
     * successfully. */
    R result();

    /** Visits a particular operand of a call, using a given visitor. */
    R visitChild(
            SqlVisitor<R> visitor,
            SqlNode expr,
            int i,
            @Nullable SqlNode operand);
}
